/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

package fr.ove.palette;

/**
 *
 * @author Mr.Sam
 */
import java.io.Serializable;

/**
* The palette information.<BR>
* The kind of palette currently used is for different operators requiring particular syntax.
* The instance of this class contain this particular syntax.<BR>
* Moreover, when these operators take one or more arguments, the syntax is often made of brackets
* and eventually separators (according to the arity of the operator). The instance of this class
* contains also an offset representing where to start entering the argument(s) of the operator.<BR>
* For example, the button (or other) in the palette associated to the trigonometric function sin, will
* will provide an instance of this class with the syntax sin() and the offset 4.
*
* @author © 1999 DIRAT Laurent
* @version 1.0  18/09/1999
*/
public class PaletteInfo implements Serializable {
    /**
    * The syntax of the associated operator in the palette.
    */
    private String syntax;
    
    /**
    * The offset associated to the syntax.
    */
    private byte offset;
    
    /**
    * the constructor.
    * @param syntax the syntax of the associated operator in the palette.
    * @param offset the offset associated to the syntax.
    */
    public PaletteInfo(String syntax, byte offset) {
        this.syntax = syntax;
        this.offset = offset;
    }
    
    /**
    * Sets the syntax of the associated operator in the palette.
    * @param syntax the syntax of the associated operator in the palette.
    */
    public void setSyntax(String syntax) {
        this.syntax = syntax;
    }
    
    /**
    * Returns the syntax of the associated operator in the palette.
    */
    public String getSyntax() {
        return syntax;
    }
    
    /**
    * Sets the offset associated to the syntax.
    * @param offset the offset associated to the syntax. Its value must be > 0
    */
    public void setOffset(byte offset) {
        this.offset = offset;
    }
    
    /**
    * Returns the offset associated to the syntax.
    */
    public byte getOffset() {
        return offset;
    }
    
    /**
    * For Debugg. Turns the instance into a String
    */
    public String toString() {
        return syntax + "\t" + offset;
    }
}